<!-- <!DOCTYPE html>
<html>
  <head>
    <title>登录页</title>
    <!-- 静态资源路径相对于 public 就是public 是根目录 -->
  
   <!-- <link rel="stylesheet" href="/stylesheets/common.css">
    <link rel="stylesheet" href="/stylesheets/login.css">
    <script src="/javascripts/jquery-1.11.3.min.js"></script>
</head>
  <body>
      <%- include header%>
    <form >
        <input type="text" id="txt1">
        <input type="text" id="txt2">
        <input type="button" id="btn" value="登录">
    </form> 
    <%- include footer%>
    <script>
        $('#btn').on('click',function(){
            $.ajax({
                url:'/users/log',
                type:'post',
                data:{
                    username:$('#txt1').val(),
                    password:$('#txt2').val(),
                },
                success:function(res){
                    console.log(res)
                    if(res.code==1){
                       location.href='/'
                    }else if(res.code==0){
                        alert('用户名或者密码错误')
                    }
                    
                }
            

            })
        })
    </script>
  </body>
</html> -->
<!DOCTYPE html>
<html>
<head>
<title>登录页</title>
<!-- For-Mobile-Apps -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script src="/javascripts/jquery-1.11.3.min.js"></script>
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //For-Mobile-Apps -->
<!-- Style --> <link rel="stylesheet" href="/stylesheets/login.css" type="text/css" media="all" />
</head>
<body>
<div class="container">
<h1>登录</h1>
	<div class="signin">
     	<form >
	      	<input type="text" class="user" value="rachelgreen" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'rachelgreen';}" id="txt1" />
	      	<input type="password" class="pass" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}" id="txt2" />
	      	<label>
		  		<input type="checkbox" value="Remember-Me" /> 记住密码?
		  	</label>
          	<input type="button" value="LOGIN" id="btn" />
	 	</form>
	</div>
</div>

<script>
    $('#btn').on('click',function(){
        console.log(111)
        $.ajax({
            url:'/users/log',
            type:'post',
            data:{
                username:$('#txt1').val(),
                password:$('#txt2').val(),
            },
            success:function(res){
                console.log(res)
                if(res.code==1){
                   location.href='/'
                }else if(res.code==0){
                    alert('用户名或者密码错误')
                }
                
            }
        

        })
    })
</script>
</body>
</html>